home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 January: Technology Seed / Jan. '98 ATS.toast / QuickTime™ 3.0b11 / QTPublicInterfaces / CIncludes / QD3DViewer.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-01-12  |  12.0 KB  |  403 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        QD3DViewer.h
  3.  
  4.      Contains:    MacOS Viewer Controller Interface File.                                
  5.  
  6.      Version:    Technology:    Quickdraw 3D 1.5.1
  7.                  Release:    QuickTime 3.0 Beta
  8.  
  9.      Copyright:    © 1995-1997 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __QD3DVIEWER__
  19. #define __QD3DVIEWER__
  20.  
  21. #ifndef __QD3D__
  22. #include <QD3D.h>
  23. #endif
  24. #ifndef __QD3DGROUP__
  25. #include <QD3DGroup.h>
  26. #endif
  27.  
  28. #if TARGET_OS_MAC
  29. #ifndef __EVENTS__
  30. #include <Events.h>
  31. #endif
  32. #ifndef __MACTYPES__
  33. #include <MacTypes.h>
  34. #endif
  35. #ifndef __QUICKDRAW__
  36. #include <Quickdraw.h>
  37. #endif
  38. #endif  /* TARGET_OS_MAC */
  39.  
  40.  
  41.  
  42. #if PRAGMA_ONCE
  43. #pragma once
  44. #endif
  45.  
  46. #ifdef __cplusplus
  47. extern "C" {
  48. #endif
  49.  
  50. #if PRAGMA_IMPORT
  51. #pragma import on
  52. #endif
  53.  
  54. #if PRAGMA_STRUCT_ALIGN
  55.     #pragma options align=power
  56. #elif PRAGMA_STRUCT_PACKPUSH
  57.     #pragma pack(push, 2)
  58. #elif PRAGMA_STRUCT_PACK
  59.     #pragma pack(2)
  60. #endif
  61.  
  62. #if PRAGMA_ENUM_ALWAYSINT
  63.     #pragma enumsalwaysint on
  64. #elif PRAGMA_ENUM_OPTIONS
  65.     #pragma option enum=int
  66. #elif PRAGMA_ENUM_PACK
  67.     #if __option(pack_enums)
  68.         #define PRAGMA_ENUM_PACK__QD3DVIEWER__
  69.     #endif
  70.     #pragma options(!pack_enums)
  71. #endif
  72.  
  73. #if TARGET_OS_MAC
  74. typedef void *                            TQ3ViewerObject;
  75. typedef CALLBACK_API_C( OSErr , TQ3ViewerDrawingCallbackMethod )(TQ3ViewerObject theViewer, const void *data);
  76.  
  77. enum {
  78.     kQ3ViewerShowBadge            = 1 << 0,
  79.     kQ3ViewerActive                = 1 << 1,
  80.     kQ3ViewerControllerVisible    = 1 << 2,
  81.     kQ3ViewerDrawFrame            = 1 << 3,
  82.     kQ3ViewerDraggingOff        = 1 << 4,
  83.     kQ3ViewerButtonCamera        = 1 << 5,
  84.     kQ3ViewerButtonTruck        = 1 << 6,
  85.     kQ3ViewerButtonOrbit        = 1 << 7,
  86.     kQ3ViewerButtonZoom            = 1 << 8,
  87.     kQ3ViewerButtonDolly        = 1 << 9,
  88.     kQ3ViewerButtonReset        = 1 << 10,
  89.     kQ3ViewerOutputTextMode        = 1 << 11,
  90.     kQ3ViewerDragMode            = 1 << 12,
  91.     kQ3ViewerDrawGrowBox        = 1 << 13,
  92.     kQ3ViewerDrawDragBorder        = 1 << 14,
  93.     kQ3ViewerDraggingInOff        = 1 << 15,
  94.     kQ3ViewerDraggingOutOff        = 1 << 16,
  95.     kQ3ViewerDefault            = 1 << 31
  96. };
  97.  
  98.  
  99. enum {
  100.     kQ3ViewerEmpty                = 0,
  101.     kQ3ViewerHasModel            = 1 << 0,
  102.     kQ3ViewerHasUndo            = 1 << 1
  103. };
  104.  
  105.  
  106. enum {
  107.     kQ3ViewerCameraRestore        = 0,
  108.     kQ3ViewerCameraFit            = 1,
  109.     kQ3ViewerCameraFront        = 2,
  110.     kQ3ViewerCameraBack            = 3,
  111.     kQ3ViewerCameraLeft            = 4,
  112.     kQ3ViewerCameraRight        = 5,
  113.     kQ3ViewerCameraTop            = 6,
  114.     kQ3ViewerCameraBottom        = 7
  115. };
  116.  
  117. typedef unsigned long                     TQ3ViewerCameraView;
  118.  
  119. enum {
  120.     gestaltQD3DViewer            = FOUR_CHAR_CODE('q3vc'),
  121.     gestaltQD3DViewerNotPresent    = 0,
  122.     gestaltQD3DViewerAvailable    = 1
  123. };
  124.  
  125.  
  126. /******************************************************************************
  127.  **                                                                             **
  128.  **        Return viewer version number                                         **
  129.  **                                                                             **
  130.  *****************************************************************************/
  131. EXTERN_API_C( OSErr )
  132. Q3ViewerGetVersion                (unsigned long *        majorRevision,
  133.                                  unsigned long *        minorRevision);
  134.  
  135.  
  136.  
  137. /******************************************************************************
  138.  **                                                                             **
  139.  **        Return viewer release version number                                 **
  140.  **        (in 'vers' format - e.g. 0x01518000 ==> 1.5.1 release)                 **
  141.  **                                                                             **
  142.  *****************************************************************************/
  143. EXTERN_API_C( OSErr )
  144. Q3ViewerGetReleaseVersion        (unsigned long *        releaseRevision);
  145.  
  146.  
  147. /******************************************************************************
  148.  **                                                                             **
  149.  **                        Creation and destruction                             **
  150.  **                Note that this is not a QuickDraw 3D object                     **
  151.  **                                                                             **
  152.  *****************************************************************************/
  153. EXTERN_API_C( TQ3ViewerObject )
  154. Q3ViewerNew                        (CGrafPtr                 port,
  155.                                  Rect *                    rect,
  156.                                  unsigned long             flags);
  157.  
  158. EXTERN_API_C( OSErr )
  159. Q3ViewerDispose                    (TQ3ViewerObject         theViewer);
  160.  
  161. /******************************************************************************
  162.  **                                                                             **
  163.  **                    Functions to attach data to a viewer                     **
  164.  **                                                                             **
  165.  *****************************************************************************/
  166. EXTERN_API_C( OSErr )
  167. Q3ViewerUseFile                    (TQ3ViewerObject         theViewer,
  168.                                  long                     refNum);
  169.  
  170. EXTERN_API_C( OSErr )
  171. Q3ViewerUseData                    (TQ3ViewerObject         theViewer,
  172.                                  void *                    data,
  173.                                  long                     size);
  174.  
  175. /******************************************************************************
  176.  **                                                                             **
  177.  **        Functions to write data out from the Viewer                             **
  178.  **                                                                             **
  179.  *****************************************************************************/
  180. EXTERN_API_C( OSErr )
  181. Q3ViewerWriteFile                (TQ3ViewerObject         theViewer,
  182.                                  long                     refNum);
  183.  
  184. EXTERN_API_C( unsigned long )
  185. Q3ViewerWriteData                (TQ3ViewerObject         theViewer,
  186.                                  Handle                 data);
  187.  
  188. /******************************************************************************
  189.  **                                                                             **
  190.  **        Use this function to force the Viewer to re-draw                     **
  191.  **                                                                             **
  192.  *****************************************************************************/
  193. EXTERN_API_C( OSErr )
  194. Q3ViewerDraw                    (TQ3ViewerObject         theViewer);
  195.  
  196. EXTERN_API_C( OSErr )
  197. Q3ViewerDrawContent                (TQ3ViewerObject         theViewer);
  198.  
  199. EXTERN_API_C( OSErr )
  200. Q3ViewerDrawControlStrip        (TQ3ViewerObject         theViewer);
  201.  
  202. /******************************************************************************
  203.  **                                                                             **
  204.  **        Function used by the Viewer to filter and handle events                 **
  205.  **                                                                             **
  206.  *****************************************************************************/
  207. EXTERN_API_C( Boolean )
  208. Q3ViewerEvent                    (TQ3ViewerObject         theViewer,
  209.                                  EventRecord *            evt);
  210.  
  211. /******************************************************************************
  212.  **                                                                             **
  213.  **        This function returns a PICT of the contents of the                  **
  214.  **        Viewer's window.  The application should dispose the PICT.             **
  215.  **                                                                             **
  216.  *****************************************************************************/
  217. EXTERN_API_C( PicHandle )
  218. Q3ViewerGetPict                    (TQ3ViewerObject         theViewer);
  219.  
  220. /******************************************************************************
  221.  **                                                                             **
  222.  **                        Calls for dealing with Buttons                         **
  223.  **                                                                             **
  224.  *****************************************************************************/
  225. EXTERN_API_C( OSErr )
  226. Q3ViewerGetButtonRect            (TQ3ViewerObject         theViewer,
  227.                                  unsigned long             button,
  228.                                  Rect *                    rect);
  229.  
  230. EXTERN_API_C( unsigned long )
  231. Q3ViewerGetCurrentButton        (TQ3ViewerObject         theViewer);
  232.  
  233. EXTERN_API_C( OSErr )
  234. Q3ViewerSetCurrentButton        (TQ3ViewerObject         theViewer,
  235.                                  unsigned long             button);
  236.  
  237. /******************************************************************************
  238.  **                                                                             **
  239.  **        Functions to set/get the group to be displayed by the Viewer.         **
  240.  **                                                                             **
  241.  *****************************************************************************/
  242. EXTERN_API_C( OSErr )
  243. Q3ViewerUseGroup                (TQ3ViewerObject         theViewer,
  244.                                  TQ3GroupObject         group);
  245.  
  246. EXTERN_API_C( TQ3GroupObject )
  247. Q3ViewerGetGroup                (TQ3ViewerObject         theViewer);
  248.  
  249. /******************************************************************************
  250.  **                                                                             **
  251.  **        Functions to set/get the color used to clear the window                 **
  252.  **                                                                             **
  253.  *****************************************************************************/
  254. EXTERN_API_C( OSErr )
  255. Q3ViewerSetBackgroundColor        (TQ3ViewerObject         theViewer,
  256.                                  TQ3ColorARGB *            color);
  257.  
  258. EXTERN_API_C( OSErr )
  259. Q3ViewerGetBackgroundColor        (TQ3ViewerObject         theViewer,
  260.                                  TQ3ColorARGB *            color);
  261.  
  262. /******************************************************************************
  263.  **                                                                             **
  264.  **        Getting/Setting a Viewer's View object.  Disposal is needed.         **
  265.  **                                                                             **
  266.  *****************************************************************************/
  267. EXTERN_API_C( TQ3ViewObject )
  268. Q3ViewerGetView                    (TQ3ViewerObject         theViewer);
  269.  
  270. EXTERN_API_C( OSErr )
  271. Q3ViewerRestoreView                (TQ3ViewerObject         theViewer);
  272.  
  273. /******************************************************************************
  274.  **                                                                             **
  275.  **        Calls for setting/getting viewer flags                                 **
  276.  **                                                                             **
  277.  *****************************************************************************/
  278. EXTERN_API_C( OSErr )
  279. Q3ViewerSetFlags                (TQ3ViewerObject         theViewer,
  280.                                  unsigned long             flags);
  281.  
  282. EXTERN_API_C( unsigned long )
  283. Q3ViewerGetFlags                (TQ3ViewerObject         theViewer);
  284.  
  285. /******************************************************************************
  286.  **                                                                             **
  287.  **        Calls related to bounds/dimensions.  Bounds is the size of              **
  288.  **        the window.  Dimensions can either be the Rect from the ViewHints     **
  289.  **        or the current dimensions of the window (if you do a Set).             **
  290.  **                                                                             **
  291.  *****************************************************************************/
  292. EXTERN_API_C( OSErr )
  293. Q3ViewerSetBounds                (TQ3ViewerObject         theViewer,
  294.                                  Rect *                    bounds);
  295.  
  296. EXTERN_API_C( OSErr )
  297. Q3ViewerGetBounds                (TQ3ViewerObject         theViewer,
  298.                                  Rect *                    bounds);
  299.  
  300. EXTERN_API_C( OSErr )
  301. Q3ViewerSetDimension            (TQ3ViewerObject         theViewer,
  302.                                  unsigned long             width,
  303.                                  unsigned long             height);
  304.  
  305. EXTERN_API_C( OSErr )
  306. Q3ViewerGetDimension            (TQ3ViewerObject         theViewer,
  307.                                  unsigned long *        width,
  308.                                  unsigned long *        height);
  309.  
  310. /* 1.1 */
  311. EXTERN_API_C( OSErr )
  312. Q3ViewerGetMinimumDimension        (TQ3ViewerObject         theViewer,
  313.                                  unsigned long *        width,
  314.                                  unsigned long *        height);
  315.  
  316. /******************************************************************************
  317.  **                                                                             **
  318.  **                            Port related calls                                 **
  319.  **                                                                             **
  320.  *****************************************************************************/
  321. EXTERN_API_C( OSErr )
  322. Q3ViewerSetPort                    (TQ3ViewerObject         theViewer,
  323.                                  CGrafPtr                 port);
  324.  
  325. EXTERN_API_C( CGrafPtr )
  326. Q3ViewerGetPort                    (TQ3ViewerObject         theViewer);
  327.  
  328. /******************************************************************************
  329.  **                                                                             **
  330.  **        Adjust Cursor should be called from idle loop to allow the Viewer     **
  331.  **        to change the cursor according to the cursor position/object under     **
  332.  **        the cursor.                                                             **
  333.  **                                                                             **
  334.  *****************************************************************************/
  335. EXTERN_API_C( Boolean )
  336. Q3ViewerAdjustCursor            (TQ3ViewerObject         theViewer,
  337.                                  Point *                pt);
  338.  
  339. EXTERN_API_C( OSErr )
  340. Q3ViewerCursorChanged            (TQ3ViewerObject         theViewer);
  341.  
  342.  
  343. /******************************************************************************
  344.  **                                                                             **
  345.  **        Returns the state of the viewer.  See the constant defined at the     **
  346.  **        top of this file.                                                     **
  347.  **                                                                             **
  348.  *****************************************************************************/
  349. EXTERN_API_C( unsigned long )
  350. Q3ViewerGetState                (TQ3ViewerObject         theViewer);
  351.  
  352. /******************************************************************************
  353.  **                                                                             **
  354.  **                            Clipboard utilities                                 **
  355.  **                                                                             **
  356.  *****************************************************************************/
  357. EXTERN_API_C( OSErr )
  358. Q3ViewerClear                    (TQ3ViewerObject         theViewer);
  359.  
  360. EXTERN_API_C( OSErr )
  361. Q3ViewerCut                        (TQ3ViewerObject         theViewer);
  362.  
  363. EXTERN_API_C( OSErr )
  364. Q3ViewerCopy                    (TQ3ViewerObject         theViewer);
  365.  
  366. EXTERN_API_C( OSErr )
  367. Q3ViewerPaste                    (TQ3ViewerObject         theViewer);
  368.  
  369. #endif  /* TARGET_OS_MAC */
  370.  
  371.  
  372.  
  373.  
  374.  
  375. #if PRAGMA_ENUM_ALWAYSINT
  376.     #pragma enumsalwaysint reset
  377. #elif PRAGMA_ENUM_OPTIONS
  378.     #pragma option enum=reset
  379. #elif defined(PRAGMA_ENUM_PACK__QD3DVIEWER__)
  380.     #pragma options(pack_enums)
  381. #endif
  382.  
  383. #if PRAGMA_STRUCT_ALIGN
  384.     #pragma options align=reset
  385. #elif PRAGMA_STRUCT_PACKPUSH
  386.     #pragma pack(pop)
  387. #elif PRAGMA_STRUCT_PACK
  388.     #pragma pack()
  389. #endif
  390.  
  391. #ifdef PRAGMA_IMPORT_OFF
  392. #pragma import off
  393. #elif PRAGMA_IMPORT
  394. #pragma import reset
  395. #endif
  396.  
  397. #ifdef __cplusplus
  398. }
  399. #endif
  400.  
  401. #endif /* __QD3DVIEWER__ */
  402.  
  403.